package tool

import play.api.data.Form
import play.api.data.Forms._
import tool.Pojo._
import play.api.data.format.Formats.doubleFormat

/**
 * Created by yz on 16/7/2021
 */
object FormTool {

  val idForm = Form(
    mapping(
      "id" -> text
    )(IdData.apply)(IdData.unapply)
  )

  val fileNameForm = Form(
    mapping(
      "fileName" -> text
    )(FileNameData.apply)(FileNameData.unapply)
  )

  val svgForm = Form(
    mapping(
      "svgHtml" -> text
    )(SvgData.apply)(SvgData.unapply)
  )

  val countryForm = Form(
    mapping(
      "country" -> text
    )(CountryData.apply)(CountryData.unapply)
  )

  val pageForm = Form(
    mapping(
      "limit" -> number,
      "offset" -> number,
      "search" -> optional(text),
    )(PageData.apply)(PageData.unapply)
  )

  val doubleMax=Double.MaxValue

}
